/*
 * Example7Threads.java  0.4.0 / 2010-10-22
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.examples;

import com.cute4j.swing.Button;
import com.cute4j.swing.Container;
import com.cute4j.swing.Label;
import com.cute4j.swing.Swing;
import com.cute4j.swing.TextField;
import com.cute4j.swing.events.ActionEvent;
import com.cute4j.swing.events.ActionListener;
import com.cute4j.swing.layouts.formlayout.CellConstraints;
import com.cute4j.swing.layouts.formlayout.FormLayout;

/**
 * Style Sheet Example.
 */
public class Example7StyleSheet extends Container {

  public Example7StyleSheet() {
    super(new FormLayout("6dlu, l:p, 4dlu, p:g, max(46dlu;p), 6dlu",
                         "6dlu, p, 3dlu, p, 3dlu, p, 4dlu, p, 6dlu"));
    setName("StyleSheet");
    CellConstraints cc = new CellConstraints();
    add(new Label("Name:"), cc.xy(2, 2));
    add(new TextField(), cc.xyw(4, 2, 2));
    add(new Label("Phone:"), cc.xy(2, 4));
    add(new TextField(), cc.xyw(4, 4, 2));
    add(new Label("EMail:"), cc.xy(2, 6));
    add(new TextField(), cc.xyw(4, 6, 2));
    Button closeButton = new Button("Close");
    closeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Swing.stopEventLoop();
      }
    });
    add(closeButton, cc.xy(5, 8));
  }

  public static void main(String[] args) {
    Swing.setStyleSheetSafely("stylesheet/stylesheet.css");
    Example7StyleSheet styleSheetExample = new Example7StyleSheet();
    styleSheetExample.setVisible(true);
    Swing.startEventLoop();
  }

}
